<?php


namespace app\index\controller;


use app\BaseController;
use app\index\business\indexBus;
use think\facade\View;

class Index extends BaseController
{
    public function index(){
        View::assign('title','首页');
        return  View::fetch();
    }
    //获取最新注册会员
    public function getNewMemberInfoList(){
        $num = $this->request->param('num');
        $indexBus = new indexBus();
        try {
            $res = $indexBus->getNewMemberInfoListBus($num);
        } catch (\Exception $exception){
            return show(config('status.error'),$exception->getMessage());
        }
        return show(config('status.success'),'查询成功',$res);
    }
    //获取招标和货源
    public function getConsignorItemOneList(){
        $num = $this->request->param('num');
        $item_category = $this->request->param('item_category');
        $indexBus = new indexBus();
        try {
            $res = $indexBus->getConsignorItemOneListBus($num,$item_category);
        } catch (\Exception $exception){
            return show(config('status.error'),$exception->getMessage());
        }
        return show(config('status.success'),'查询成功',$res);
    }
    //获取首页新闻显示
    public function getNewsLimitList(){
        $num = $this->request->param('num');
        $indexBus = new indexBus();
        try {
            $res = $indexBus->getNewsLimitListBus($num);
        } catch (\Exception $exception){
            return show(config('status.error'),$exception->getMessage());
        }
        return show(config('status.success'),'查询成功',$res);
    }
    //获取首页公告显示
    public function getNoticeLimitList(){
        $num = $this->request->param('num');
        $indexBus = new indexBus();
        try {
            $res = $indexBus->getNoticeLimitListBus($num);
        } catch (\Exception $exception){
            return show(config('status.error'),$exception->getMessage());
        }
        return show(config('status.success'),'查询成功',$res);
    }
    //获取首页公告显示
    public function getLinkLimitList(){
        $num = $this->request->param('num');
        $indexBus = new indexBus();
        try {
            $res = $indexBus->getLinkLimitListBus($num);
        } catch (\Exception $exception){
            return show(config('status.error'),$exception->getMessage());
        }
        return show(config('status.success'),'查询成功',$res);
    }
    //获取首页banner图片
    public function getBannerLimitList(){
        $num = $this->request->param('num');
        $indexBus = new indexBus();
        try {
            $res = $indexBus->getBannerLimitListBus($num);
        } catch (\Exception $exception){
            return show(config('status.error'),$exception->getMessage());
        }
        return show(config('status.success'),'查询成功',$res);
    }

    //获取首页显示的货主企业
    public function getConsignorLimitList(){
        $num = $this->request->param('num');
        $indexBus = new indexBus();
        try {
            $res = $indexBus->getConsignorLimitListBus($num);
        } catch (\Exception $exception){
            return show(config('status.error'),$exception->getMessage());
        }
        return show(config('status.success'),'查询成功',$res);
    }
    //获取首页显示的物流企业
    public function getLogisticsLimitList(){
        $num = $this->request->param('num');
        $indexBus = new indexBus();
        try {
            $res = $indexBus->getLogisticsLimitListBus($num);
        } catch (\Exception $exception){
            return show(config('status.error'),$exception->getMessage());
        }
        return show(config('status.success'),'查询成功',$res);
    }
    //获取广告
    public function getAdvertisingLimitList(){
        $id = $this->request->param('id');
        $where = [
            'id'=>$id
        ];
        $indexBus = new indexBus();
        try {
            $res = $indexBus->getAdvertisingLimitListBus($where);
        } catch (\Exception $exception){
            return show(config('status.error'),$exception->getMessage());
        }
        return show(config('status.success'),'查询成功',$res);
    }

}